%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Calcul de l'erreur
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function [ erreur,carteErreur ] = Erreur( donnees, typeErreur )


donneesAdaptees=donnees;

if strcmp(donneesAdaptees.chargement,'ponctuel')==1
   
    donneesAdaptees.forceLineiqueA = 0;
    donneesAdaptees.forceLineiqueB = 0;
    donneesAdaptees.forceLineiqueC = 0;

    
elseif strcmp(donneesAdaptees.chargement,'reparti')==1
        
    donneesAdjoint.F = 0;
    
end













if strcmp(typeErreur,'explicite')==1
    
    erreur = EvalErrGlob(donneesAdaptees);
    carteErreur = 0;
    
elseif strcmp(typeErreur,'dirichlet')==1
    
    [erreur, carteErreur]= Err_globale_patch_Dirichlet(donneesAdaptees);
    
elseif strcmp(typeErreur,'RdC')==1
    
    [erreur, carteErreur] = ERdC(donneesAdaptees);
    
else
    
    disp('Le type d''erreur choisi n''est pas parmi les choix possibles (explicite, dirichlet, RdC). ');
        
end


end

